home *** CD-ROM | disk | FTP | other *** search
/ Shareware Overload Trio 2 / Shareware Overload Trio Volume 2 (Chestnut CD-ROM).ISO / dir34 / dsktest.zip / DTEST.DOC < prev    next >
Text File  |  1993-05-25  |  6KB  |  167 lines

  1.  
  2. THIS IS MODIFIED FROM AN ARTICLE IN PC COMPUTING, APR 91, page 176.
  3.  
  4. Syntax:  DTEST D:   where D: = a floppy drive letter
  5.  
  6. A DT.BAT file is provided which simplifies use.  It can be modified to
  7. your own purposes.
  8.  
  9. Results from DTEST are stored in errorlevels as shown below.
  10. These have been modified from those in the original article to reflect
  11. a more consistent approach.  For example, the original version had the
  12. two answers for formatted disks returning non-sequential EL's, in
  13. fact, they were at the extremes, 0 and 4.  The arrangement used here
  14. treats higher EL's as representing increasing degree of "problem."
  15.  
  16.     0   disk is formatted--no files, no label
  17.  
  18.     1   disk is formatted--
  19.         has files on it
  20.         and/or has a volume label.
  21.         Byte 149 defines this errorlevel code.
  22.  
  23.     2   disk is unformatted
  24.  
  25.     3   no disk in drive
  26.  
  27.  
  28. NOTE: A formatted disk that has a volume label will return EL=1 regardless of
  29. whether or not it has files on it.  This is because a  volume label resides in
  30. the disk's directory structure and will appear to be a file to DTEST.
  31.  
  32.  
  33. DTEST.SCR  (usage is DEBUG<DTEST.SCR to create DTEST.COM)
  34. There must be a blank line after "Q".
  35.  
  36. N DTEST.COM
  37. E100 A0 80 00 0A C0 74 0D A0   82 00 24 5F 2E A2 52 01
  38. E110 2C 41 EB 02 B0 00 B9 01   00 BA 00 00 BB 59 01 CD
  39. E120 25 73 12 80 FC 1F 73 09   80 FC 08 74 04 B0 02 EB
  40. E130 1D B0 03 EB 19 BA 80 00   B4 1A CD 21 B4 4E BA 52
  41. E140 01 B9 FF FF CD 21 72 04   B0 01 EB 02 B0 00 B4 4C
  42. E150 CD 21 41 3A 5C 2A 2E 2A   00
  43. RCX
  44. 59
  45. W
  46. Q
  47.  
  48. ----------------------
  49.  
  50. Dissasembly of DTEST.COM using DEBUG "u" command:
  51.  
  52. -u100 158
  53.  
  54. 1471:0100 A08000        MOV    AL,[0080]                          
  55. 1471:0103 0AC0          OR    AL,AL                              
  56. 1471:0105 740D          JZ    0114                               
  57. 1471:0107 A08200        MOV    AL,[0082]                          
  58. 1471:010A 245F          AND    AL,5F                              
  59. 1471:010C 2E            CS:                                       
  60. 1471:010D A25201        MOV    [0152],AL                          
  61. 1471:0110 2C41          SUB    AL,41                              
  62. 1471:0112 EB02          JMP    0116                               
  63. 1471:0114 B000          MOV    AL,00                              
  64. 1471:0116 B90100        MOV    CX,0001                            
  65. 1471:0119 BA0000        MOV    DX,0000                            
  66. 1471:011C BB5901        MOV    BX,0159                            
  67. 1471:011F CD25          INT    25                                 
  68. 1471:0121 7312          JNB    0135                               
  69. 1471:0123 80FC1F        CMP    AH,1F                              
  70. 1471:0126 7309          JNB    0131                               
  71. 1471:0128 80FC08        CMP    AH,08                              
  72. 1471:012B 7404          JZ    0131                               
  73. 1471:012D B001          MOV     AL,02
  74. 1471:012F EB1D          JMP    014E                               
  75. 1471:0131 B002          MOV     AL,03
  76. 1471:0133 EB19          JMP    014E                               
  77. 1471:0135 BA8000        MOV    DX,0080                            
  78. 1471:0138 B41A          MOV    AH,1A                              
  79. 1471:013A CD21          INT    21                                 
  80. 1471:013C B44E          MOV    AH,4E                              
  81. 1471:013E BA5201        MOV    DX,0152                            
  82. 1471:0141 B9FFFF        MOV    CX,FFFF                            
  83. 1471:0144 CD21          INT    21                                 
  84. 1471:0146 7204          JB    014C                               
  85. 1471:0148 B004          MOV     AL,01
  86. 1471:014A EB02          JMP    014E                               
  87. 1471:014C B000          MOV    AL,00                              
  88. 1471:014E B44C          MOV    AH,4C                              
  89. 1471:0150 CD21          INT    21                                 
  90. 1471:0152 41            INC    CX                                 
  91. 1471:0153 3A5C2A        CMP    BL,[SI+2A]                         
  92. 1471:0156 2E            CS:                                       
  93. 1471:0157 2A00          SUB    AL,[BX+SI]                         
  94.  
  95. -------- DT.BAT ----------
  96. @echo off
  97. If (%1)==() goto NOPARAM
  98. for %%A in ( c: C: d: D: e: E: f: F: g: G: ) do if %1==%%A goto NOPARAM
  99. dtest %1
  100. echo.
  101. call errlev.bat
  102.  
  103. if errorlevel 3 goto NODISK
  104. if errorlevel 2 goto UNFOR
  105. if errorlevel 1 goto FILES-OR-VOL
  106. if errorlevel 0 goto NOFILESNOVOL
  107.  
  108. REM Modify the following sections to perform the actions you want
  109. REM to happen depending on the status of the disk test.
  110.  
  111. :NODISK
  112. echo.
  113. echo there is no disk in %1
  114. echo.
  115. goto END
  116.  
  117. :UNFOR
  118. echo.
  119. echo the disk in %1 is unformatted
  120. echo.
  121. goto END
  122.  
  123. :FILES-OR-VOL
  124. echo.
  125. echo the disk in %1 is formatted and has files and/or a volume label
  126. echo.
  127. goto END
  128.  
  129. :NOFILESNOVOL
  130. echo.
  131. echo the disk in %1 is formatted and has neither a volume label nor files on it.
  132. echo.
  133. goto END
  134.  
  135. :NOPARAM
  136. echo.
  137. echo A floppy disk must be specified.  Use DT a: =or= DT b:
  138. echo ...or a hard disk drive was named. Specify only floppies.
  139. echo.
  140.  
  141. :END
  142. ---------- End of DT.BAT -------------
  143. ---------- Begin ERRLEV.BAT ----------
  144. @echo off
  145. rem Use CALL ERRLEV.BAT (DOS 3.3+) in a batch file to place the errorlevel
  146. rem into the environment as EL=xxx where xxx is an ASCII(!) string
  147. rem representation of the errorlevel. It is also written to the screen.
  148. set EL=
  149. for %%V in (0 1 2) do if errorlevel %%V00 set EL=%%V
  150. if "%EL%"=="2" goto OVER200
  151. for %%V in (0 1 2 3 4 5 6 7 8 9) do if errorlevel %EL%%%V0 set EL=%EL%%%V
  152. goto DIGIT2
  153. :OVER200
  154. for %%V in (0 1 2 3 4 5) do if errorlevel %EL%%%V0 set EL=%EL%%%V
  155. :DIGIT2
  156. if "%EL%"=="25" goto OVER250
  157. goto DIGIT3
  158. :OVER250
  159. for %%V in (0 1 2 3 4 5) do if errorlevel %EL%%%V set EL=%EL%%%V
  160. goto DONE
  161. :DIGIT3
  162. for %%V in (0 1 2 3 4 5 6 7 8 9) do if errorlevel %EL%%%V set EL=%EL%%%V
  163. :DONE
  164. echo The resulting ERRORLEVEL value transferred to the environment is EL=%EL%
  165.  
  166. --------- End ERRLEV.BAT --------------
  167.